package test.y2021;

import cn.hutool.core.lang.Console;
import cn.hutool.core.lang.Opt;
import com.alibaba.fastjson.JSON;
import common.dto.ShopVo;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author song
 * @date 2021/10/22 14:45
 */
public class October1 {
    public static void main(String[] args) {

        /*  Opt.ofNullable  没有懂这个怎么用的；也不知道痛点是什么 */

        ShopVo shopVo = new ShopVo();

        List<ShopVo> collect = Opt.ofNullable(shopVo).stream().filter(i -> 1 == i.getFee()).collect(Collectors.toList());

        Opt<ShopVo> shopVoOpt = Opt.ofNullable(shopVo);
        if (shopVoOpt.isPresent()) {
            ShopVo ssss = shopVoOpt.peek(i -> i.setAddress("ssss")).get();
        }

        ShopVo shopVo1 = Opt.ofNullable(shopVo).peek(i -> i.setAddress("123")).get();

        Console.error(JSON.toJSONString(shopVo1));
    }
}
